export default {
  setProducts (state, data) { // 同步数据到vuex
    state.products = data
  },
  reducePrice (state, num) { // 商品减10
    state.products.forEach((product) => {
      product.price -= num
    })
  },
  addPrice (state) { // 商品+10
    state.products.forEach((product) => {
      product.price += 10
    })
  },
  addPriceAsync (state) { // 异步2秒后加100
    state.products.forEach((product) => {
      product.price += 100
    })
  }
}
